﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class ComponetExtent
{
    //扩展一个改变颜色的方法,要哪个类型谁扩展,第一个参数就是哪个类型,前面加个this
    public static void ChangeColor(this Component component, Color color)
    {
        Renderer render = component.GetComponent<Renderer>();
        if (render)
        {
            render.material.color = color;
        }
    }
}